# 九九乘法表：使用占位符输出
# 使用 while输出四种
i = 1
while i < 10:
    j = 1
    while j <= i:
        print('{}*{}={:<4}'.format(i,j,i*j), end='')
        j += 1
    i += 1
    print('')
print('='*80)
i = 9
while i >=0:
    j = 1
    while j <= i:
        print('{}*{}={:<4}'.format(i, j, i * j), end='')
        j += 1
    i -= 1
    print('')

i = 1
while i < 10:
    j = i
    while 0 < 9-j:
        print('{:<8}'.format(''), end='')
        j += 1
    j = i
    while j >= 1:
        print('{}*{}={:<4}'.format(i,j-1+1,i*j), end='')
        j -= 1
    i += 1
    print('')
print('='*80)

i = 9
while i > 0:
    j = i
    while 0 < 9-j:
        print('{:<8}'.format(''), end='')
        j += 1
    j = i
    while j >= 1:
        print('{}*{}={:<4}'.format(i,j-1+1,i*j), end='')
        j -= 1
    i -= 1
    print('')


# 使用 for in 输出四种
for i in range(1,10):
   for j in range(1,i+1):
       print('{}*{}={:<4}'.format(i,j,i*j), end='')
   print('')
print('='*80)
for i in range(9, 0, -1):
   for j in range(1,i+1):
       print('{}*{}={:<4}'.format(i,j,i*j), end='')
   print('')
for i in range(1,10):
    for j in range(1, 10-i):
        print('{:<8}'.format(''), end='')
    for j in range(i,0,-1):
        print('{}*{}={:<4}'.format(i,j,i*j), end='')
    print('')
print('='*80)
for i in range(9, 0, -1):
    for j in range(1, 10 - i):
        print('{:<8}'.format(''), end='')
    for j in range(i, 0, -1):
        print('{}*{}={:<4}'.format(i, j, i * j), end='')
    print('')